Wildform Wildform is the creator of the SWfX SWF text effects generator and the Flix SWF video encoder.
This tutorial was written to accompany and explain the attached .FLA, authored in Flash 4.

last modified October 30, 2000
©2000 Wildform, Inc.
<- back to tutorials
Scroll Bar
Concepts Covered
GetProperty
Buttons
Masks
Scroll Bar
To demonstrate this scroll bar mechanism, I have included the FLA and SWF of the FAQ from the SWfX help system. The scroll bar is in the question movie clip, on the left.

download this .fla


There are three basic objects in this scroll bar mechanism: the content, a mask, and the scroll bar itself. In addition, there are two frames of action script in this movie. The mask is the area of the content you want visible. The content itself must be a movie clip named "list" - whether or not you choose to make this a static, single-frame movie, or a dynamic, interactive movie in itself is up to you. The scroll bar must be a movie named "scroll". Align everything for a good appearance.

If you wish to use thisset variables code in your own movies, simply copy and paste. As well, you must specify the values of four variables in the first frame of the action layer in the scroll movie:


TargetTop = the center-y-coordinate of the "list" movie when it is in its top position
TargetBot = the center-y-coordinate of the "list" movie when it is in its bottom position
BoxTop = the center-y-coordinate of the "box" movie when it is in its top position
BoxBot = the center-y-coordinate of the "box" movie when it is in its bottom position


The easiest way to do this is to select the "list" or "box" movie, and copy the y value from the object inspector in Flash. IMPORTANT: be certain that "use center point" is checked in the object inspector, otherwise you will copy incorrect values.

You will also need to adjust the variable "steps". This is the number of scroll intervals from the top to the bottom - the longer the list, the more steps you will want.

If you are using dynamically edited text fields (or if you are feeling adventurous), you will need to adapt this code so that it reads these values automatically. Simply alter the action script to derive the values for these variables dynamically, by getting the y origin and the height of the 'list' movie. You would also want to define the variable "steps" as the height of the list divided by some constant of your choice (depending on the amount of smoothness of scrolling you desire).
<- back to tutorials
©2000 Wildform, Inc.